﻿<%@ WebHandler Language="C#" Class="DataLanguages" %>

using System;
using System.Web;
using System.Text;
using System.Web.SessionState;
using Newtonsoft.Json.Converters;
using DB.DataService;
using System.Data;

public class DataLanguages : IHttpHandler
{

    public void ProcessRequest(HttpContext context)
    {
        //Dung tam thoi sau nay thi tao tu database
        try
        {
            context.Response.ContentType = "text/plain";
            StringBuilder strLanguage = new StringBuilder();
            DataTable tb = new DataTable();
            tb = TableLanguage();
            strLanguage.Append(Newtonsoft.Json.JsonConvert.SerializeObject(tb));
            context.Response.Write(strLanguage);
        }
        catch (Exception)
        {

            throw;
        }


    }

    private DataTable TableLanguage()
    {
        DataTable tb = new DataTable();
        try
        {
            tb.Columns.Add("id", typeof(int));
            tb.Columns.Add("text", typeof(string));
            tb.Columns.Add("icon", typeof(string));
            tb.Rows.Add(1, "Việt Nam", "VietNam.png");
            tb.Rows.Add(2, "English", "United_States.png");
        }
        catch (Exception)
        {


        }
        return tb;
    }
    public bool IsReusable
    {
        get
        {
            return false;
        }
    }

}